package biblioteca.contrlador;



import biblioteca.persistencia.Persona;
import java.io.IOException;


import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class AltaPersonaServlet extends HttpServlet {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws IOException {
		
		
		
		String email = req.getParameter("email");
	    String contrasena=req.getParameter("contrasena");
	    String permisos=req.getParameter("permisos");
	    
		
		 if ((email.length() == 0 && email == null) || (contrasena.length() == 0 && contrasena == null) || (permisos.length() == 0 && permisos == null)){
		    	resp.sendRedirect("altaPersona.jsp?accion=altaP");
		    }else{
		    	Persona persona=new Persona(email,contrasena,permisos);
		        
		        resp.sendRedirect("altaPersona.jsp?accion=altaP");
		    }
		
	}

}
